home *** CD-ROM | disk | FTP | other *** search
/ BUG 6 / BUGCD1997_09.BIN / APLIC / PAGEMAKR / ARCHIVE.Z / Nested Ungroup.SPT < prev    next >
Text File  |  1996-10-31  |  2KB  |  76 lines

  1. -- Nested Ungroup
  2. -- 1 Oct 96, vs
  3.  
  4. -- This script will allow you to ungroup a group created
  5. -- with the "nested group" script. After running this script
  6. -- the original groups will be retained.
  7.  
  8. getselectidlisttop => n,ID,...,...,...,type,...
  9. if not(n,type=1,14)
  10.     return
  11. endif
  12. try getprivatestring "Vlad","NGrp",classobject,0,ID =>..., TOC
  13. if empty(TOC)
  14.     ungroup
  15.     return
  16. endif
  17. set ~""(TOC)=>TOC
  18. while not(empty(TOC))
  19.     set TOC=>i,TOC
  20.     getprivatestring "Vlad","NGrp",classobject,i,ID =>..., g[i]
  21.     set ~""(g[i]) => g[i]
  22. endwhile
  23.  
  24. ungroup
  25. deselect
  26. set g[ID]=>root
  27. while not(empty(root))
  28.     if root(1)>0
  29.         break
  30.     endif
  31.     set root=>G,root
  32.     set g[-G]=>group
  33.     if group(1)>0
  34.         rem select'em all & group
  35.         while not(empty(group))
  36.             set group=>k,group
  37.             try selectidextend k
  38.         endwhile
  39.         try group
  40.         deselect
  41.     else
  42.     set => toc
  43.     while group(1)<0
  44.         set group=>i,group
  45.         set g[-i]=>gi
  46.         set toc,-i=>toc
  47.         loop j=1,len(gi)
  48.             if gi(j)<0
  49.                 set gi(j),group=>group
  50.             else 
  51.                 set  group,gi(j)=>group
  52.             endif
  53.         endloop
  54.     endwhile
  55.     rem select'em all;group;assign private data by 'toc' and new group id
  56.     deselect
  57.     while not(empty(group))
  58.         set group=>k,group
  59.         selectidextend k
  60.     endwhile
  61.     group
  62.     getselectidlisttop => ...,id,...
  63.     privatestring "Vlad","NGrp",classobject,0,1,id,1,""(id,toc)
  64.     privatestring "Vlad","NGrp",classobject,id,1,id,1,""(g[-G])
  65.     while not(empty(toc))
  66.         set toc=>k,toc
  67.         privatestring "Vlad","NGrp",classobject,k,1,id,1,""(g[k])
  68.     endwhile
  69.     deselect    
  70.     endif
  71. endwhile
  72.  
  73. return
  74.  
  75.     
  76.